/********************************************************************************
 * Project Name		[JavaEE_Web]
 * File Name     	[StudentDaoFactory.java]
 * Creation Date 	[2015-01-01]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ********************************************************************************/
package mvc.dao.factory;

import java.util.HashMap;
import java.util.Map;

import mvc.dao.IStudentDao;
import mvc.dao.impl.StudentDaoHibernateImpl;
import mvc.dao.impl.StudentDaoJdbcImpl;

/**
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 * 
 */
public class StudentDaoFactory {

	private Map<String, IStudentDao> daos = new HashMap<String, IStudentDao>();
	private String daoType = null;

	private static StudentDaoFactory instance = new StudentDaoFactory();

	private StudentDaoFactory() {
		super();
		daos.put("jdbc", new StudentDaoJdbcImpl());
		daos.put("hibernate", new StudentDaoHibernateImpl());
		// TODO
	}

	public static StudentDaoFactory getInstance() {
		return instance;
	}

	public void setType(String type) {
		this.daoType = type;
	}

	public IStudentDao getStudentDao() {
		return daos.get(daoType);
	}
}
